const mongoose = require('mongoose')
const config = require('../config/index')

mongoose.connect(config.MONGODB_URL, {
  useNewUrlParser: true,
  useUnifiedTopology: true
})

const db = mongoose.connection;

db.on('open', () => console.log('数据库链接成功'));
db.on('error', () => console.log('数据库链接失败'))